package com.ylbh.modules.shopping_orderform.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ylbh.common.pojo.goodsorder.dto.ExternalOrderDTO;
import com.ylbh.common.pojo.goodsorder.vo.ExternalOrderVO;
import com.ylbh.common.utils.PageUtils;
import com.ylbh.modules.shopping_orderform.dao.ShoppingForeignOrderDao;
import com.ylbh.modules.shopping_orderform.entity.ShoppingForeignOrder;
import com.ylbh.modules.shopping_orderform.service.ShoppingForeignOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ShoppingForeignOrderServiceImpl extends ServiceImpl<ShoppingForeignOrderDao, ShoppingForeignOrder> implements ShoppingForeignOrderService{

    @Autowired
    private ShoppingForeignOrderDao shoppingForeignOrderDao;
    @Override
    public PageUtils queryExternalOrderList(Map<String, Object> params) {
        Page<Object> page = new Page<>(Integer.parseInt(params.get("page").toString()), Integer.parseInt(params.get("limit").toString()));
        List<ExternalOrderVO> list = shoppingForeignOrderDao.selectOrderList(params,page);
        Page<ExternalOrderVO> page1 = new Page<>();
        page1.setRecords(list).setTotal(page.getTotal());
        return new PageUtils(page1);
    }

    @Override
    public ExternalOrderVO queryExternalOrderById(String id) {
        return shoppingForeignOrderDao.selectExternalOrderById(id);
    }
}
